package LC;

import org.w3c.dom.Node;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Queue;

/**
 * 辅助栈思想
 */
public class 最小栈 {
    Deque minstack;
    Deque numbers;
    public 最小栈() {
       minstack=new ArrayDeque();
       numbers=new ArrayDeque();
       //minstack.push(Integer.MAX_VALUE);
    }

    public void push(int val) {
       minstack.push(Math.min((int) minstack.peek(),val));
       numbers.push(val);
    }

    public void pop() {
      minstack.pop();
      numbers.pop();
    }

    public int top() {
     return (int) numbers.peek();
    }

    public int getMin() {
      return (int)minstack.peek();
    }



}
